package org.xb.decoupling02;

class UserService {
    private DatabaseConnection databaseConnection;

    // 通过构造函数注入依赖
    public UserService(DatabaseConnection databaseConnection) {
        this.databaseConnection = databaseConnection;
    }

    public void performDatabaseOperation() {
        databaseConnection.connect();
        // 执行数据库操作逻辑
        System.out.println("Performing database operation...");
    }
}

